package com.koron.ticket.operation.mapper;

import com.koron.ticket.operation.bean.OperationTicketBean;
import com.koron.ticket.operation.bean.OperationWorkBean;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface OperationWorkMapper {
    int deleteByPrimaryKey(String id);

    int insert(OperationWorkBean record);

    int insertSelective(OperationWorkBean record);

    OperationWorkBean selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(OperationWorkBean record);

    int updateByPrimaryKey(OperationWorkBean record);

    int batchInsert(@Param("list") List<OperationWorkBean> list);

    //根据工作票号 查 工作票id
    @Select(" select id from w_ticket_work where code = #{code} limit 1 ")
    String queryWorkIdByCode(String code);

    @Select("SELECT GROUP_CONCAT(`work_code` SEPARATOR ',') work_code FROM `w_ticket_operation_work` where operation_id=#{operationId} GROUP BY operation_id")
    String queryWorkCodeByOperationId(String operationId);

    List<OperationWorkBean> queryByOperationId(@Param("operationId") String operationId);

    int deleteByOperationId(@Param("operationId")String operationId);

    // 工具工作票查 操作票
    List<OperationTicketBean> queryByWorkId(@Param("workId")String workId);

    // 兴化 工作票检查 操作票
    List<OperationTicketBean> queryByWorkIdAndStatus(@Param("workId")String workId, @Param("status") Integer status);

}